package com.example.demoboot.controller;

import com.example.demoboot.bean.Test;
import com.example.demoboot.bean.User;
import com.example.demoboot.service.TestService;
import com.example.demoboot.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Random;

@Controller
@RequestMapping("/toLogin")
public class TestController {
    @Autowired
    private TestService testService;


    @RequestMapping("/loginOut")
    @ResponseBody
    public String singleUseLogin() throws Exception {
       List<Test>  ss=testService.getTest("fff");
        String url = "ssdsdsd";
        return url;
    }

    @RequestMapping("/loginOut2")
    @ResponseBody
    public  List<User>  singleUseLogin2() throws Exception {
        String randomString = StringUtils.getRandomString(5);
        User user2 = User.builder().name(randomString).age(18).motto(randomString).build();
        List<User>  ss=testService.getTest2(user2);
        String url = "ssdsdsd";
        System.out.println(ss);
        return ss;
    }



}
